//
//  ViewOfCountry.m
//  project-A (pianke)
//
//  Created by dllo on 16/2/29.
//  Copyright © 2016年 scott. All rights reserved.
//

#import "ViewOfCountry.h"
#import <DKNightVersion.h>
#define WIDTH [UIScreen mainScreen].bounds.size.width

#define HEIGHT  [UIScreen mainScreen].bounds.size.height

@implementation ViewOfCountry


-(instancetype)initWithFrame:(CGRect)frame img:(NSString *)img title:(NSString *)title{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self creatViewWith:img title:title];
    }
    
    return self;
}

-(void)creatViewWith:(NSString *)img title:(NSString *)title{
    
    
    
    UIImageView *imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:img]];
    imageview.frame = CGRectMake(30, 5, (WIDTH - 20)/4 - 60, (WIDTH - 20)/4 - 60);
    
    
    
    
    [self addSubview:imageview];
    
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(20,(WIDTH - 20)/4 - 45, (WIDTH - 20)/4 - 40,20)];
    label.text = title;
    label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:label];
    
    label.dk_backgroundColorPicker = DKColorWithColors([UIColor whiteColor],[UIColor grayColor]);

    
    
    [imageview release];
    [label release];
    
}

-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    self.block();
    
}

@end
